<!--
 * @Description:  hls
 * @Author: xuzp4
 * @Date: 2021-11-04 14:52:52
 * @LastEditors: xuzp4
 * @LastEditTime: 2022-09-22 14:23:15
 * @FilePath: \vue_demo\src\view\video2\rtmp.vue
-->
<template>
  <div>
    <video-player :options="videoOptions" />
  </div>
</template>

<script>
import VideoPlayer from "./videoPlayer.vue";
// require('videojs-flash')
// const { createFFmpeg, fetchFile } = FFmpeg;

// const ffmpeg = createFFmpeg({

//     corePath: 'https://unpkg.com/@ffmpeg/core@0.8.5/dist/ffmpeg-core.js',

//     log: true,

//  });
 
//  const transcode = async ({ target: { files } }) => {

//    const message = document.getElementById('message');

//      const { name } = files[0];

//       message.innerHTML = 'Loading ffmpeg-core.js';

//      await ffmpeg.load();

//       ffmpeg.FS('writeFile', 'name', await fetchFile(files[0]));

//       message.innerHTML = 'Start transcoding';

//      await ffmpeg.run('-i', 'name', 'output.mp4');

//       message.innerHTML = 'Complete transcoding';

//      const data = ffmpeg.FS('readFile', 'output.mp4');

//      const video = document.getElementById('output-video');

//       video.src = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4' }));

//    }

//    const elm = document.getElementById('uploader');

//    elm.addEventListener('change', transcode);
export default {
  components: {
    VideoPlayer,
  },
  data() {
    return {
      videoOptions: {
        autoplay: true,
        controls: true,
        sources: [
        // hls视频流
          {
            src: "http://220.161.87.62:8800/hls/0/index.m3u8",
            type: "application/x-mpegURL",
          },
        ],
      },
    };
  },
};
</script>

<style>
</style>